
$(function(){
	
	init()
})


function   init(){
	$.getJSON("/tbpoject/good/getallgood",{},function(data){
		var msg="";
		for(var j=0;j<data.length;j++){
			$.ajax({
					url:"/tbpoject/good/getgoodsbyid",
					data:{"gid":data[j].gid},
					type:"get",
					dataType:"json",
					async:false,
					success:function(item){
//						alert(item.name)
			msg+='<li class="J_FavListItem g-i-item fav-item" data-id="544232616725" data-ownerid="384686628" data-spm="">'
			msg+='<div class="img-controller-box J_FavImgController">'
			msg+='<div class="img-controller-img-box">'
				
			msg+='<a href="#" class="img-controller-img-link" target="_blank" data-spm="d4919233" title="'+item.name+'">'
			                
			msg+='<img class="img-controller-img" src="collection_files/'+j+'.jpg" alt=""/>'
			                
			msg+='</a>'
			msg+='</div>'
			        
			msg+='<a tabindex="-1" class="findsame-btn" href="/item_gallery_n.htm?id=544232616725&cat=1&sellerId=384686628&tab=0" target="_blank" data-spm="">找相似</a>'
			        
			        
			msg+='<a tabindex="-1" class="go-shop-link" target="_blank" href="//store.taobao.com/shop/view_shop.htm?user_number_id=384686628" title="进入店铺" >进入店铺</a>'
			        
			        
			msg+='<div class="delete-box" data-spm="">'
			msg+='<div class="delete-btn-bg"></div>'
			msg+='<div class="delete-btn J_DeleteItem" title="删除宝贝" > <a href="javascript:deleteById('+data[j].gid+');">删除</a></div>'
			msg+='</div>'
			msg+='<div class="note">'
			msg+='<div class="note-bg"></div>'
			msg+='<div class="note-txt">'
			msg+='<span class="note-txt-icon"></span>添加备注</div>'
			msg+='</div>'
			        
			msg+='</div>'
			msg+='<div class="img-item-title">'
			msg+='<a class="img-item-title-link" title="'+item.name+'" target="_blank" href="#" data-spm="">'+item.name+'</a>'
			msg+='</div>'
			msg+='<div class="price-container">'


			msg+='<div class="g_price-box">'
			msg+='<div data-title="优惠促销;直降:39.00元"class="J_PriceIcon_j picon-j" data-p="5900" data-op="5900">'
			               
			 msg+='</div>'
			        
			msg+='<div class="g_price"><span>&yen;</span><strong>'+item.price+'</strong></div>'
			    

			msg+='<div class="g_price g_price-original"><span>&yen;</span><span>220</span></div>'

			msg+='</div>'
			msg+='</div>'
			    
			msg+='<div class="other-container">'
			msg+='</div>'
			msg+='<div class="edit-pop-bg"></div>'
			msg+='<div class="edit-pop-border"></div>'
			msg+='<div class="edit-pop-btn J_Edit_Pop_Btn" data-spm-click="gostr=/tbscj;locaid=d3sel">'
			msg+='<i class="edit-icon"></i>'
			            
			msg+='<div class="item-pk-txt J_Item_PKtxt"></div>'
			            
			msg+='</div>'
			msg+='</div>'
			msg+='</li>'
					}})
		    	
		}
		
	 $("#collectiongoods").html(msg);
			
	})
	
}


function deleteById(gid){
	$.getJSON("/tbpoject/good/deletecollectiongoodsbyid",{"gid":gid},function(data){
		if(data=="ok"){
			alert("删除成功！")
			init()
		}
	})
}
 
